Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added transformation service support #20

Merged
merged 4 commits into from
Feb 2, 2022

Conversation

seime
Copy link
Collaborator

@seime seime commented Jan 9, 2022

No description provided.

@baumgm
Copy link

baumgm commented Jan 9, 2022

The transformation has an additional signature for using jsonpath

Transformation.transform("JSONPATH",` "$.name", "{\"name\":\"test\"}");

Can you add that too?
I am not sure if it's the method from the TransformationHelper. I found another class org.openhab.core.transform.actions.Transformation, maybe that can help.

@seaside1
Copy link
Owner

I think this looks good. Perhaps we should add some documentation as well?

@baumgm
Copy link

baumgm commented Jan 13, 2022

I check the docu a little bit more and think you are right, this should work for jsonpath too. I just come from the jython rules and there its separated. Your syntax is more used in the items and sitemaps.

Some examples also for json would be good.

String value = Transformation.transform("JSONPATH($.name):%s", "{"name":"test"}");
String value = Transformation.transform("MAP(my.map):%s", event.getValue()");
vs.
String value = Transformation.transform("JSONPATH", "$.name", "{"name":"test"}");
String value = Transformation.transform("MAP", "my.map", event.getValue()");

Personally i find the second syntax better for programming. Either way its good to have the transformation in.

@seaside1
Copy link
Owner

Great I will test it out and merge.

@seaside1
Copy link
Owner

seaside1 commented Feb 2, 2022

Sorry for the late review, been too busy but putting some work in now.
I'll look at the documentation as well

@seaside1 seaside1 merged commit 2844f64 into seaside1:main Feb 2, 2022
seaside1 added a commit that referenced this pull request Apr 5, 2022
Added transformation service support

Former-commit-id: 2844f64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants